package com.usian.user.controller.v1;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

/**
 * @author 秉性哥
 * @createTime 2022/10/14 18:55
 * @description
 */
public class ArrayTest {
    public static void main(String[] args) {
        arrayMax();
        arrayListMax();
    }

    public static int arrayMax(){
        int arr[]={1,2,3,4};
        int a = Arrays.stream(arr).max().getAsInt();
        System.out.println(a);
        return a;
    }
    public static int arrayListMax(){
        ArrayList<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        Integer max = Collections.max(list);
        System.out.println(max);
        return max;
    }
}
